package com.kevin.dao;

import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.IocBean;

import com.kevin.common.PassUtil;
import com.kevin.model.Manager;

/**
 * 管理员数据库访问
 * @author Administrator
 *
 */
@IocBean
public class ManagerDao extends BasicDao {
	/**
	 * 管理员登录
	 * @param username
	 * @param password
	 * @return
	 */
	public Manager login(String username,String password){

		Cnd condition = Cnd.where("username", "=", username);
		Manager m = findByCondition(Manager.class,condition);
		if(m != null){
			if(!PassUtil.decryptPass(m.getPassword()).equals(password)){
				m = null;
			}			
		}
		return  m;
	}

}
